﻿using System;

namespace Oxage.Drivers
{
	/// <summary>
	/// Implements a communication channel between computer and device.
	/// </summary>
	public interface IConnector //IDriver, IController
	{
		/// <summary>
		/// When implemented gets a friendly name of the controller.
		/// </summary>
		string Name { get; }

		/// <summary>
		/// When implemented opens the channel.
		/// </summary>
		void Open();

		/// <summary>
		/// When implemented closes the channel.
		/// </summary>
		void Close();

		/// <summary>
		/// When implemented sends raw data to the machine.
		/// </summary>
		/// <param name="data">Raw data to be sent.</param>
		void Write(byte[] data);

		//event EventHandler<ConnectorEventArgs> DataSent;

		//int Read(byte[] buffer, int start, int length);

		/// <summary>
		/// When implemented notifies when a message is received.
		/// </summary>
		event EventHandler<ConnectorEventArgs> DataReceived;
	}
}
